#==============================================================================
#  ExCommand_MessageLock
#------------------------------------------------------------------------------
# @[͂̕\] sۂɁAbZ[W̕\̓LN^[ړȂ
# 悤ɐݒł悤ɂXNvgfނłB
#==============================================================================

# tOɎgpXCb` IDB
# ̔ԍ̃XCb` ON ɂƁA[͂̕\] sĂԁA
# }bvׂ̂ẴLN^[ [ړ] ꎞ~܂B
# @\ʂł OFF ɂ邱Ƃł܂B
EXCMD_MSGLOCK_SID = 4

#------------------------------------------------------------------------------

class Game_Character
  #--------------------------------------------------------------------------
  #  bN (sΏۈȊÕCxgp)
  #--------------------------------------------------------------------------
  def secondary_lock
    unless @locked
      @prelock_direction = @direction
      @locked = true
    end
  end
end

class Game_Interpreter
  alias _excmsgl_command_end command_end
  alias _excmsgl_command_101 command_101
  #--------------------------------------------------------------------------
  #  Cxg̏I (ǉ`)
  #--------------------------------------------------------------------------
  def command_end
    _excmsgl_command_end
    unless $BTEST
      for i in $game_map.events.keys
        $game_map.events[i].unlock
      end
    end
  end
  #--------------------------------------------------------------------------
  #  ͂̕\ (ǉ`)
  #--------------------------------------------------------------------------
  def command_101
    unless $BTEST
      if $game_switches[EXCMD_MSGLOCK_SID]
        for i in $game_map.events.keys
          event = $game_map.events[i]
          event.secondary_lock if @event_id != event.id
        end
      end
    end
    _excmsgl_command_101
  end
end
